import UrlRequest from './request';

const isResponseSuccess = (response) => {
  return response && response.code && response.code === '0';
}

const urlRequest = new UrlRequest(isResponseSuccess);

class UsercenterRequest {
  request (options) {
    return urlRequest.request(options);
  }
  get (options) {
    return urlRequest.get(options);
  }
  post (options) {
    return urlRequest.post(options);
  }
  async retRequest (options) {
    const res = await urlRequest.request(options);
    return { retData: res?.data };
  }
}

export default new UsercenterRequest();
